package com.webcamtracker.tracker.example.pong;

import com.webcamtracker.move.tracking.AplicationListener;
import com.webcamtracker.move.tracking.TrackingEventDispacher;
import com.webcamtracker.move.tracking.TrackingEventType;

import javax.swing.*;
import java.awt.*;


public class PongFrame extends JFrame implements AplicationListener {

    private PongPanel pongPanel;

    public PongFrame() {
        super("Pong Frame!");
        start();
    }

    public void start() {

        pongPanel = new PongPanel(new Dimension(320, 240));

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setContentPane(pongPanel);
        pack();
       // setLocationRelativeTo(null);
        setVisible(true);
    }

    public static void main(String[] args) {
        new PongFrame();
    }

    public void subscribeToTracking(TrackingEventDispacher dispacher, String elementId)
    {
        dispacher.addTrackingEventListener(pongPanel, TrackingEventType.ALL);
    }
}